package cn.szzsi.programmer.controller;

import cn.szzsi.common.util.CommonUtil;
import cn.szzsi.core.dubbo.DubboService;
import cn.szzsi.dto.WeChatThirdPlateformDto;
import cn.szzsi.service.WeChatConfigInterface;
import com.jfinal.core.Controller;
import com.jfinal.kit.Ret;

/**
 * 微信配置
 * Created by admin on 2017/7/21.
 */
public class WeChatConfigController extends Controller{
    WeChatConfigInterface weChatConfigInterface= DubboService.getInstance().imports(WeChatConfigInterface.class);

    public void view(){
        WeChatThirdPlateformDto weChatThirdPlateformDto=weChatConfigInterface.viewThirdPlateformConfig("1");
        setAttr("weChatThirdPlateformDto",weChatThirdPlateformDto);
        render(CommonUtil.TEMPLATE_PATH+"/programmer/wechatconfig/wechat_config_view.html");
    }

    public void updateform(){
        WeChatThirdPlateformDto weChatThirdPlateformDto=weChatConfigInterface.viewThirdPlateformConfig("1");
        setAttr("weChatThirdPlateformDto",weChatThirdPlateformDto);
        render(CommonUtil.TEMPLATE_PATH+"/programmer/wechatconfig/wechat_config_input.html");
    }

    public void update(){
        String thirdAppId=getPara("thirdAppId");
        String thirdSecret=getPara("thirdSecret");
        weChatConfigInterface.updateThirdPlateformConfig(thirdAppId,thirdSecret);
        renderJson(Ret.ok("info","修改成功!").set("url","view"));
    }
}
